<?php
declare(strict_types=1);
namespace SixShop\AliyunWuliu\Controller;

use SixShop\AliyunWuliu\Entity\ExtensionWuLiuEntity;
use SixShop\Core\Request;
use function SixShop\Core\success_response;

class IndexController
{
    public function index(Request $request, ExtensionWuLiuEntity $entity)
    {
        $params = $request->get([
            'no/s',
            'type/s' => ''
        ]);
        validate( [
            'no' => 'require|alphaNum',
            'type' => 'alphaNum'
        ])->check($params);
        return success_response($entity->getWuliuInfo((int)$request->userID,$params['no'], $params['type']));
    }
}